package com.es.designmode.chain;

/**
 * 同 ConcreteHandler1，条件改变
 *
 * @author Will
 */
public class ConcreteHandler2 extends Handler {
    @Override
    public void handleRequest(int request) {
        int req10 = 10;
        int req20 = 20;

        if (request >= req10 && request < req20) {
            // 10到 20 处理请求
            System.out.println(this.getClass().getName() + "处理请求" + request);
        } else if (getSuccessor() != null) {
            // 转移到下一位
            getSuccessor().handleRequest(request);
        }
    }
}
